package com.smartsystem.common.config;

import com.smartsystem.common.interceptor.JwtAuthInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * Web MVC配置类
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    
    @Resource
    private JwtAuthInterceptor jwtAuthInterceptor;
    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 暂时禁用JWT拦截器，等基础功能测试通过后再启用
        /*
        registry.addInterceptor(jwtAuthInterceptor)
                .addPathPatterns("/api/**") // 拦截所有API请求
                .excludePathPatterns(
                        "/api/v1/auth/login",      // 登录接口
                        "/api/v1/auth/register",   // 注册接口
                        "/api/v1/auth/refresh",    // Token刷新接口
                        "/api/test/**",            // 测试接口
                        "/doc.html",               // Swagger文档
                        "/swagger-ui/**",          // Swagger UI
                        "/v3/api-docs/**",         // OpenAPI文档
                        "/swagger-resources/**",   // Swagger资源
                        "/webjars/**",             // Web资源
                        "/favicon.ico",            // 图标
                        "/error"                   // 错误页面
                );
        */
    }
}